<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>django 3 分分钟搭建一个restful api | Jin Tian</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="Django" />
  
  
  
  
  <meta name="description" content="Django restframework 简介时间过得好快，不知不觉这就是Django系列教程的第三部分了，这部分我们将在一分钟之内用django的一个第三方框架-Django restframework搭建我们的第一个api。首先闲话不多说让我们先安装一下这个框架：sudo pip3 install django-restframework ok，安装完之后能让我们新建一个project吧dja">
<meta name="keywords" content="Django">
<meta property="og:type" content="article">
<meta property="og:title" content="Django 3 分分钟搭建一个RESTful API">
<meta property="og:url" content="http://yoursite.com/2017/01/16/Django-3-分分钟搭建一个RESTful-API/index.html">
<meta property="og:site_name" content="Jin Tian">
<meta property="og:description" content="Django restframework 简介时间过得好快，不知不觉这就是Django系列教程的第三部分了，这部分我们将在一分钟之内用django的一个第三方框架-Django restframework搭建我们的第一个api。首先闲话不多说让我们先安装一下这个框架：sudo pip3 install django-restframework ok，安装完之后能让我们新建一个project吧dja">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2017-01-26T10:42:16.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Django 3 分分钟搭建一个RESTful API">
<meta name="twitter:description" content="Django restframework 简介时间过得好快，不知不觉这就是Django系列教程的第三部分了，这部分我们将在一分钟之内用django的一个第三方框架-Django restframework搭建我们的第一个api。首先闲话不多说让我们先安装一下这个框架：sudo pip3 install django-restframework ok，安装完之后能让我们新建一个project吧dja">
  
    <link rel="alternate" href="/atom.xml" title="Jin Tian" type="application/atom+xml">
  

  

  <link rel="icon" href="/css/images/mylogo.jpg">
  <link rel="apple-touch-icon" href="/css/images/mylogo.jpg">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/9749f0/00000000000000000001008f/27/l?subset_id=2&fvd=n5) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/90cf9f/000000000000000000010091/27/l?subset_id=2&fvd=n7) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/8a5494/000000000000000000013365/27/l?subset_id=2&fvd=n4) format("woff2");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/d337d8/000000000000000000010095/27/l?subset_id=2&fvd=i4) format("woff2");font-weight:400;font-style:italic;}</style>
  <link rel="stylesheet" href="/css/style.css">

  <script src="/js/jquery-3.1.1.min.js"></script>
  <script src="/js/bootstrap.js"></script>

  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/css/bootstrap.css" >

  
    <link rel="stylesheet" href="/css/dialog.css">
  

  

  
    <link rel="stylesheet" href="/css/header-post.css" >
  

  
  
  
    <link rel="stylesheet" href="/css/vdonate.css" >
  

</head>



  <body data-spy="scroll" data-target="#toc" data-offset="50">


  
  <div id="container">
    <div id="wrap">
      
        <header>

    <div id="allheader" class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="navbar-inner">
          
          <div class="container"> 
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
            </button>

            
              <a class="brand" style="
                 border-width: 0px;  margin-top: 0px;"  
                href="#" data-toggle="modal" data-target="#myModal" >
                  <img width="124px" height="124px" alt="Hike News" src="/css/images/mylogo.jpg">
              </a>
            
            
            <div class="navbar-collapse collapse">
              <ul class="hnav navbar-nav">
                
                  <li> <a class="main-nav-link" href="/">首页</a> </li>
                
                  <li> <a class="main-nav-link" href="/archives">归档</a> </li>
                
                  <li> <a class="main-nav-link" href="/categories">分类</a> </li>
                
                  <li> <a class="main-nav-link" href="/tags">标签</a> </li>
                
                  <li> <a class="main-nav-link" href="/about">关于</a> </li>
                
                  <li> <a class="main-nav-link" href="http://luoli-luoli.com/chat">chat</a> </li>
                
                  <li><div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="请输入关键词..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(无标题)',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
<script src="/js/insight.js"></script>

</div></li>
            </div>
          </div>
                
      </div>
    </div>

</header>



      
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-Django-3-分分钟搭建一个RESTful-API" style="width: 75%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
  <div id="articleInner" class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      Django 3 分分钟搭建一个RESTful API
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	<a href="/2017/01/16/Django-3-分分钟搭建一个RESTful-API/" class="article-date">
	  <time datetime="2017-01-16T15:31:58.000Z" itemprop="datePublished">2017-01-16</time>
	</a>

      
      
	<a class="article-views">
	<span id="busuanzi_container_page_pv">
		阅读量<span id="busuanzi_value_page_pv"></span>
	</span>
	</a>

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Django-restframework-简介"><a href="#Django-restframework-简介" class="headerlink" title="Django restframework 简介"></a>Django restframework 简介</h3><p>时间过得好快，不知不觉这就是Django系列教程的第三部分了，这部分我们将在一分钟之内用django的一个第三方框架-Django restframework搭建我们的第一个api。首先闲话不多说让我们先安装一下这个框架：<br><figure class="highlight cmake"><table><tr><td class="code"><pre><div class="line">sudo pip3 <span class="keyword">install</span> django-restframework</div></pre></td></tr></table></figure></p>
<p>ok，安装完之后能让我们新建一个project吧<br><figure class="highlight ebnf"><table><tr><td class="code"><pre><div class="line"><span class="attribute">django-admin startproject ara</span></div></pre></td></tr></table></figure></p>
<p>接着新建一个app：<br><figure class="highlight stylus"><table><tr><td class="code"><pre><div class="line">python3 manage<span class="selector-class">.py</span> startapp users</div></pre></td></tr></table></figure></p>
<p>ok这时候我们的项目结构应该是这样的：<br><figure class="highlight stylus"><table><tr><td class="code"><pre><div class="line">.</div><div class="line">├── ara</div><div class="line">│   ├── __init__<span class="selector-class">.py</span></div><div class="line">│   ├── settings<span class="selector-class">.py</span></div><div class="line">│   ├── urls<span class="selector-class">.py</span></div><div class="line">│   └── wsgi<span class="selector-class">.py</span></div><div class="line">└── users</div><div class="line">    ├── __init__<span class="selector-class">.py</span></div><div class="line">    ├── admin<span class="selector-class">.py</span></div><div class="line">    ├── apps<span class="selector-class">.py</span></div><div class="line">    ├── models<span class="selector-class">.py</span></div><div class="line">    ├── tests<span class="selector-class">.py</span></div><div class="line">    └── views.py</div></pre></td></tr></table></figure></p>
<p>ok，简单易懂，接着还是我们配置一下restframework吧</p>
<h3 id="Restframework配置"><a href="#Restframework配置" class="headerlink" title="Restframework配置"></a>Restframework配置</h3><p>配置这个框架请依照这个步骤来，缺一不可：</p>
<ul>
<li><p><strong>在settings.py中我们install一下</strong></p>
<figure class="highlight sml"><table><tr><td class="code"><pre><div class="line"><span class="type">INSTALLED_APPS</span> = [</div><div class="line">    <span class="symbol">'django</span>.contrib.admin',</div><div class="line">    <span class="symbol">'django</span>.contrib.auth',</div><div class="line">    <span class="symbol">'django</span>.contrib.contenttypes',</div><div class="line">    <span class="symbol">'django</span>.contrib.sessions',</div><div class="line">    <span class="symbol">'django</span>.contrib.messages',</div><div class="line">    <span class="symbol">'django</span>.contrib.staticfiles',</div><div class="line">    <span class="symbol">'users'</span>,</div><div class="line">    <span class="symbol">'rest_framework'</span></div><div class="line">]</div></pre></td></tr></table></figure>
</li>
<li><p><strong>在settings.py中添加这个</strong></p>
<figure class="highlight ada"><table><tr><td class="code"><pre><div class="line"># using rest_framework setting this line</div><div class="line">REST_FRAMEWORK = &#123;</div><div class="line">    # <span class="keyword">Use</span> Django<span class="symbol">'s</span> standard `django.contrib.auth` permissions,</div><div class="line">    # <span class="keyword">or</span> allow read-only <span class="keyword">access</span> <span class="keyword">for</span> unauthenticated users.</div><div class="line">    <span class="symbol">'DEFAULT_PERMISSION_CLASSES</span>': [</div><div class="line">        <span class="symbol">'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly</span>'</div><div class="line">    ]</div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
</ul>
<p>ok，经过这个配置之后，我们就可以在项目中import restframework了。接下来我要向同志们展示一下这个东西到底有多么吊炸天！</p>
<h3 id="三步搞定一套API，增删改查！"><a href="#三步搞定一套API，增删改查！" class="headerlink" title="三步搞定一套API，增删改查！"></a>三步搞定一套API，增删改查！</h3><p>我说过只用三步，那我们就分三步来。</p>
<ul>
<li><strong>第1步：</strong> 当然是新建一个models</li>
</ul>
<p>二话不多说直接复制粘贴代码：<br><figure class="highlight python"><table><tr><td class="code"><pre><div class="line"><span class="comment"># -*- coding: utf-8 -*-</span></div><div class="line"><span class="keyword">from</span> django.db <span class="keyword">import</span> models</div><div class="line"></div><div class="line"></div><div class="line"><span class="comment"># Create your models here.</span></div><div class="line"><span class="class"><span class="keyword">class</span> <span class="title">User</span><span class="params">(models.Model)</span>:</span></div><div class="line">    <span class="string">"""</span></div><div class="line">    name: name of user,</div><div class="line">    gender: user's gender</div><div class="line">    wechat: user's wechat</div><div class="line">    """</div><div class="line">    name = models.CharField(max_length=<span class="number">100</span>, blank=<span class="keyword">False</span>)</div><div class="line">    gender = models.CharField(max_length=<span class="number">4</span>, blank=<span class="keyword">True</span>)</div><div class="line">    birthday = models.DateField(blank=<span class="keyword">True</span>)</div><div class="line">    portrait_url = models.CharField(max_length=<span class="number">100</span>, blank=<span class="keyword">True</span>)</div><div class="line">    home = models.CharField(max_length=<span class="number">20</span>, blank=<span class="keyword">True</span>)</div><div class="line">    phone = models.CharField(max_length=<span class="number">17</span>, blank=<span class="keyword">True</span>)</div><div class="line">    email = models.CharField(max_length=<span class="number">20</span>, blank=<span class="keyword">True</span>)</div><div class="line">    wechat = models.CharField(max_length=<span class="number">20</span>, blank=<span class="keyword">True</span>)</div><div class="line">    company = models.CharField(max_length=<span class="number">20</span>, blank=<span class="keyword">True</span>)</div><div class="line">    occupation = models.CharField(max_length=<span class="number">20</span>, blank=<span class="keyword">True</span>)</div><div class="line">    living_city = models.CharField(max_length=<span class="number">20</span>, blank=<span class="keyword">True</span>)</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">def</span> <span class="title">__str__</span><span class="params">(self)</span>:</span></div><div class="line">        <span class="keyword">return</span> self.name</div></pre></td></tr></table></figure></p>
<ul>
<li><strong>第2步：</strong> 在app下新建serializers.py，写入这些代码</li>
</ul>
<p>二话不多说直接复制粘贴代码：<br><figure class="highlight python"><table><tr><td class="code"><pre><div class="line"><span class="keyword">from</span> rest_framework <span class="keyword">import</span> serializers, viewsets</div><div class="line"><span class="keyword">from</span> users.models <span class="keyword">import</span> User</div><div class="line"></div><div class="line"></div><div class="line"><span class="class"><span class="keyword">class</span> <span class="title">UsersSerializer</span><span class="params">(serializers.ModelSerializer)</span>:</span></div><div class="line"></div><div class="line">    <span class="class"><span class="keyword">class</span> <span class="title">Meta</span>:</span></div><div class="line">        model = User</div><div class="line">        fields = <span class="string">'__all__'</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="comment"># ViewSets define the view behavior.</span></div><div class="line"><span class="class"><span class="keyword">class</span> <span class="title">UsersViewSet</span><span class="params">(viewsets.ModelViewSet)</span>:</span></div><div class="line">    queryset = User.objects.all()</div><div class="line">    serializer_class = UsersSerializer</div></pre></td></tr></table></figure></p>
<p>在这里我们实现一个UsersSerializers以及一个UsersViewSet这两个类，这个序列化函数暂且不知道是干毛的，但是很显然这个函数的作用是把从数据库中查询的结果序列化为字符串。不过重点是这个ViewSet，这个东西就这么几行代码它就帮你实现好了增、删、改、查的所有功能。不是吹牛逼等一下我们来验证看看是不是。<br>你会惊奇的发现，有了这个ViewSet之后我们都不用写view.py了！！！！！</p>
<ul>
<li><strong>第3步：</strong> 配置urls<br>二话不多说直接复制粘贴代码：<figure class="highlight python"><table><tr><td class="code"><pre><div class="line"><span class="keyword">from</span> django.conf.urls <span class="keyword">import</span> url, include</div><div class="line"><span class="keyword">from</span> django.contrib <span class="keyword">import</span> admin</div><div class="line"><span class="keyword">from</span> users.serializers <span class="keyword">import</span> UsersViewSet</div><div class="line"><span class="keyword">from</span> rest_framework <span class="keyword">import</span> routers</div><div class="line"></div><div class="line">router = routers.DefaultRouter()</div><div class="line">router.register(<span class="string">r'api/v1/users'</span>, UsersViewSet)</div><div class="line"></div><div class="line">urlpatterns = [</div><div class="line">    url(<span class="string">r'^admin/'</span>, admin.site.urls),</div><div class="line">    url(<span class="string">r'^api-auth/'</span>, include(<span class="string">'rest_framework.urls'</span>, namespace=<span class="string">'rest_framework'</span>)),</div><div class="line">    url(<span class="string">r'^'</span>, include(router.urls))</div><div class="line">]</div></pre></td></tr></table></figure>
</li>
</ul>
<p>配置urls要用到restframework中的router这个类，这个是一个路由器，或者说是分发器，request的网址分发过来我发给哪个view处理就有他来决定，但是很显然这里并没有发给任何一个view，而是直接发给了一个ViewSet，这个ViewSet结合我们的serializer就可以实现我们的返回json或者接受json的全套功能！就是这么的屌！屌的爆炸！！<br>好吧，最后说一下urlpatterns里面的几个pattern，第一个是admin不需要多说，重点是最后一个我们include了router的urls，所以说你只需要按照router的网址来写即可，不过重点是router还实现了一个隐士查询也就是你可以加具体数字查询具体的detail。</p>
<h3 id="Django-restframework测试！"><a href="#Django-restframework测试！" class="headerlink" title="Django restframework测试！"></a>Django restframework测试！</h3><p>说了这么多来测试一下呗！！我们输入：<br><figure class="highlight awk"><table><tr><td class="code"><pre><div class="line">http:<span class="regexp">//</span><span class="number">127.0</span>.<span class="number">0.1</span>:<span class="number">8000</span><span class="regexp">/api/</span>v1<span class="regexp">/users</span></div></pre></td></tr></table></figure></p>
<p>看看返回的结果：<br><figure class="highlight groovy"><table><tr><td class="code"><pre><div class="line">HTTP <span class="number">200</span> OK</div><div class="line"><span class="string">Allow:</span> GET, POST, OPTIONS</div><div class="line">Content-<span class="string">Type:</span> application/json</div><div class="line"><span class="string">Vary:</span> Accept</div><div class="line"></div><div class="line">[</div><div class="line">    &#123;</div><div class="line">        <span class="string">"id"</span>: <span class="number">1</span>,</div><div class="line">        <span class="string">"name"</span>: <span class="string">"金天"</span>,</div><div class="line">        <span class="string">"gender"</span>: <span class="string">"男"</span>,</div><div class="line">        <span class="string">"birthday"</span>: <span class="string">"1993-12-11"</span>,</div><div class="line">        <span class="string">"portrait_url"</span>: <span class="string">"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1593523098,2479335990&amp;fm=116&amp;gp=0.jpg"</span>,</div><div class="line">        <span class="string">"home"</span>: <span class="string">"江西南昌"</span>,</div><div class="line">        <span class="string">"phone"</span>: <span class="string">"15116123160"</span>,</div><div class="line">        <span class="string">"email"</span>: <span class="string">"1195889656@qq.com"</span>,</div><div class="line">        <span class="string">"wechat"</span>: <span class="string">"jintianilveu"</span>,</div><div class="line">        <span class="string">"company"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"occupation"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"living_city"</span>: <span class="string">""</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">        <span class="string">"id"</span>: <span class="number">2</span>,</div><div class="line">        <span class="string">"name"</span>: <span class="string">"Elgins"</span>,</div><div class="line">        <span class="string">"gender"</span>: <span class="string">"男"</span>,</div><div class="line">        <span class="string">"birthday"</span>: <span class="string">"1994-11-02"</span>,</div><div class="line">        <span class="string">"portrait_url"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"home"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"phone"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"email"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"wechat"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"company"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"occupation"</span>: <span class="string">""</span>,</div><div class="line">        <span class="string">"living_city"</span>: <span class="string">""</span></div><div class="line">    &#125;</div><div class="line">]</div></pre></td></tr></table></figure></p>
<p>在网页中你可以直接测试POST PUT GET等方法，总是很牛逼有没有！！分分钟做一套API啊！！比java web快出了不知道多少倍！！！明天我们继续深入探测这个东西！！！！！</p>

      
    </div>
    <footer class="article-footer">
      
        <div id="donation_div"></div>

<script src="/js/vdonate.js"></script>
<script>
var a = new Donate({
  title: '骚年，加个好友打赏一下啊，现在连泡面都吃不起了啊', // 可选参数，打赏标题
  btnText: '打赏支持', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: 'https://i.loli.net/2017/09/27/59cb048ba6838.jpeg',
  alipayImage: 'https://i.loli.net/2017/09/27/59cb049cd0951.jpeg'
});
</script>
      
      
        
	<div id="comment">
		<!-- 来必力City版安装代码 -->
		<div id="lv-container" data-id="city" data-uid="MTAyMC8zMDA5MC82NjQ1">
		<script type="text/javascript">
		   (function(d, s) {
		       var j, e = d.getElementsByTagName(s)[0];

		       if (typeof LivereTower === 'function') { return; }

		       j = d.createElement(s);
		       j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
		       j.async = true;

		       e.parentNode.insertBefore(j, e);
		   })(document, 'script');
		</script>
		<noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
		</div>
		<!-- City版安装代码已完成 -->
	</div>



      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Django/">Django</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2017/01/26/Django-4-django和postgreSQL/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">上一篇</strong>
      <div class="article-nav-title">
        
          Django 4 django和postgreSQL
        
      </div>
    </a>
  
  
    <a href="/2017/01/15/Django-2-MySQL-and-Blog/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">下一篇</strong>
      <div class="article-nav-title">Django 2 MySQL and Blog</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="toc-sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">文章目录</strong>
    
        <ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#Django-restframework-简介"><span class="nav-number">1.</span> <span class="nav-text">Django restframework 简介</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Restframework配置"><span class="nav-number">2.</span> <span class="nav-text">Restframework配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#三步搞定一套API，增删改查！"><span class="nav-number">3.</span> <span class="nav-text">三步搞定一套API，增删改查！</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Django-restframework测试！"><span class="nav-number">4.</span> <span class="nav-text">Django restframework测试！</span></a></li></ol>
    
    </div>
  </aside>
</section>
        
      </div>
      
      <footer id="footer">
  

  <div class="container">
      	<div class="row">
	      <p> Powered by <a href="http://www.luoli-luoli.com/" target="_blank">萝莉萝莉</a> and <a href="http://www.luoli-luoli.com/sia" target="_blank">Sia</a> </p>
	      <p id="copyRightEn">Copyright &copy; 2017 - 2018 Jin Tian All Rights Reserved.</p>
	      
	      
    		<p class="busuanzi_uv">
				访客数 : <span id="busuanzi_value_site_uv"></span> |  
				访问量 : <span id="busuanzi_value_site_pv"></span>
		    </p>
  		   
		</div>

		
  </div>
</footer>


<!-- min height -->

<script>
    var wrapdiv = document.getElementById("wrap");
    var contentdiv = document.getElementById("content");
    var allheader = document.getElementById("allheader");

    wrapdiv.style.minHeight = document.body.offsetHeight + "px";
    if (allheader != null) {
      contentdiv.style.minHeight = document.body.offsetHeight - allheader.offsetHeight - document.getElementById("footer").offsetHeight + "px";
    } else {
      contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("footer").offsetHeight + "px";
    }
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/categories" class="mobile-nav-link">Categories</a>
  
    <a href="/tags" class="mobile-nav-link">Tags</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
    <a href="http://luoli-luoli.com/chat" class="mobile-nav-link">Chat</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/scripts.js"></script>




  <script src="/js/dialog.js"></script>








	<div style="display: none;">
    <script src="https://s95.cnzz.com/z_stat.php?id=1260716016&web_id=1260716016" language="JavaScript"></script>
  </div>



	<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h2 class="modal-title" id="myModalLabel">设置</h2>
      </div>
      <hr style="margin-top:0px; margin-bottom:0px; width:80%; border-top: 3px solid #000;">
      <hr style="margin-top:2px; margin-bottom:0px; width:80%; border-top: 1px solid #000;">


      <div class="modal-body">
          <div style="margin:6px;">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" onclick="javascript:setFontSize();" aria-expanded="true" aria-controls="collapseOne">
              正文字号大小
            </a>
          </div>
          <div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
          <div class="panel-body">
            您已调整页面字体大小
          </div>
        </div>
      


          <div style="margin:6px;">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" onclick="javascript:setBackground();" aria-expanded="true" aria-controls="collapseTwo">
              夜间护眼模式
            </a>
        </div>
          <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
          <div class="panel-body">
            夜间模式已经开启，再次单击按钮即可关闭 
          </div>
        </div>

        <div>
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;关 于&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
        </div>
         <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
          <div class="panel-body">
            Jin Tian
          </div>
          <div class="panel-body">
            Copyright © 2018 Jintian All Rights Reserved.
          </div>
        </div>
      </div>


      <hr style="margin-top:0px; margin-bottom:0px; width:80%; border-top: 1px solid #000;">
      <hr style="margin-top:2px; margin-bottom:0px; width:80%; border-top: 3px solid #000;">
      <div class="modal-footer">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
      </div>
    </div>
  </div>
</div>
  
  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/js/totop.js?v=1.0.0" async=""></script>
  
    <a id="menu-switch"><i class="fa fa-bars fa-lg"></i></a>
  
</body>
</html>